package system.imp;

import java.io.DataInputStream;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import system.base.*;
import system.base.WarehouseCategory;
import framework.core.DBConnection;
import framework.core.DateUtil;
import framework.core.ILoginContext;
import framework.core.LogWriter;


/**
 * 导入Excel文件到数据库
 */
public class GWFileDownProcessor implements GWBaseProcesser{

    public static String doExcelSaveToDB(DataInputStream aFile, DBConnection con, ILoginContext loginContext,String tableName,String warehouseCode) throws GWException
    {
        return doExcelSaveToDB(aFile,con,loginContext,tableName,warehouseCode,ClientDownupfileInfo.DOWNLOADTYPE_DOWN);
    }
    public static String doExcelSaveToDB(DataInputStream aFile, DBConnection con, ILoginContext loginContext,String tableName,String warehouseCode,String upDownType) throws GWException
    {
        String strReturn ="";
        
        //T_WAREHOUSE_CATEGORY表的处理
        if (tableName.equalsIgnoreCase(WarehouseCategory.TABLE_NAME))
        {
            strReturn = ExcelWarehouseCategoryToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }
        
        //T_INOUT_TYPE 表的处理
        if (tableName.equalsIgnoreCase(InoutType.TABLE_NAME))
        {
            strReturn = ExcelInoutTypeToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        }   
        //T_CUSTOMER表的处理
        if (tableName.equalsIgnoreCase(Customer.TABLE_NAME))
        {
            strReturn = ExcelCustomerToDB.doSaveToDB(aFile, con, loginContext,tableName,warehouseCode,upDownType);
        } 
        
        return strReturn;
    }
    

}